package me.keiwu.user.dao;

import me.keiwu.user.domain.Area;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by kei on 16/03/2018.
 */
public interface AreaDao extends BaseDao<Area, Long> {


    @Query(value = "select * from area where type=?1 order by rand() limit ?2", nativeQuery = true)
    List<Area> findRandNByType(Integer type, Integer n);


    @Query(value = "select * from area where type=?1 order by rand() limit 1", nativeQuery = true)
    Area findRandByType(Integer type);


}
